<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .big{
            height: 288px;
            width: 288px;
            border: 1px  black solid;
            position: absolute;
            left: 500px;
            background-color: yellow;

        }
     </style>
</head>
<body>
    <div class="big" id="big"></div>
</body>
<script>
    var big = document.getElementById("big");
    document.onkeydown=function(event){
        var code=event.keyCode;
        switch(code)
        {
            case 37:
                alert("左!");
            break;

            case 38:
                alert("上!");
            break;

            case 39:
                alert("右!");
            break;

            case 40:
                alert("下!");
            break;

            default:
            alert("请输入上下左右!");
        }
    }
</script>
</html>